import request1 from "@/utils/request1";

// 定义注册账号信息类型
export interface loginParams {
    phone:String,
    password:String,
    code?:String
}

export interface userInfoData {
    "id": Number | String,
    "loginName": String,
    "nickName": String,
    "passwd": String,
    "name": String,
    "phoneNum": String,
    "email"?:String ,
    "headImg": String,
    "userLevel": String,
    "status": Number,
    "birthday"?: string,
    "gender": String,
    "createTime": String,
    "operateTime": String,
    "openId"?: string
}




export default{
    // 获取用户信息
   getUserInfo(){
    return request1.get<any,any>('/api/user/passport/auth/getUserInfo')
   },
    // 用户注册
    register(loginParams:loginParams){
        return request1.post<any,any>('/api/user/passport/register',loginParams)
    },
    // 获取验证码
    getCode(phone:String){
        return request1.get<any,any>(`/api/user/passport/sendCode/${phone}`)
    },
    // 用户登录
    Login(params:loginParams){
        return request1.post<any,any>('/api/user/passport/login',params)
    } ,
    // 退出登录
    Logout(){
        return request1.get<any,null>('/api/user/passport/logout')
    }
}
